package movie;

import java.util.List;
import net.sf.jtmdb.CastInfo;
import net.sf.jtmdb.GeneralSettings;
import net.sf.jtmdb.Movie;
/**
* @author Savvas Dalkitsis
*/
public class Test {
    public static void main(String[] args) {
        GeneralSettings.setApiKey("1d51cef38e888586924becd5f1cc9b1d");
        try {
            List<Movie> movies = Movie.search("Harry potter");
            for (Movie movie : movies) {
                System.out.println("====================");
                System.out.println(movie.getName());
                System.out.println(movie.getOverview());
                System.out.println("Cast:");
                // Get the full decsription of the movie.
                Movie movieFull = Movie.getInfo(movie.getID());
                for (CastInfo cast : movieFull.getCast()) {
                    System.out.println("   " + cast.getName() + " as "
                            + cast.getCharacterName());
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}